﻿using System.Collections.Generic;
using System.ServiceModel;
namespace WCF.Common
{
    [ServiceContract]
    public interface INorOpSv
    {
        #region 用户表
        /// <summary>获取所有用户表的数据。</summary>
        /// <returns>返回用户清单。</returns>
        [OperationContract]
        List<UserObject> GetUsers();
        /// <summary>插入用户数据。</summary>
        /// <param name="obj">要添加的用户信息。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult InsertUser(UserObject obj);
        /// <summary>删除用户数据。</summary>
        /// <param name="id">要删除用户信息的编号。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult DeleteUser(string id);
        /// <summary>更新用户数据。</summary>
        /// <param name="obj">要添加的用户信息。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult UpdateUser(UserObject obj);
        #endregion

        #region 角色表
        /// <summary>获取所有角色。</summary>
        /// <returns>返回角色清单。</returns>
        [OperationContract]
        List<RoleObject> GetRoles();
        /// <summary>添加一个新角色。</summary>
        /// <param name="role">要添加到角色信息。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult InsertRole(RoleObject role);
        /// <summary>删除一个角色信息。</summary>
        /// <param name="id">要删除角色信息的编号。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult DeleteRole(string id);
        /// <summary>更新一个角色信息。</summary>
        /// <param name="role">要更新的角色信息。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult UpdateRole(RoleObject role);
        #endregion

        #region 应用表
        /// <summary>获取应用</summary>
        /// <returns>返回应用清单。</returns>
        [OperationContract]
        List<AppObject> GetApps();
        /// <summary>添加一个新应用。</summary>
        /// <param name="obj">要添加的应用信息。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult InsertApp(AppObject obj);
        /// <summary>删除一个应用信息。</summary>
        /// <param name="id">要删除应用信息的编号。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult DeleteApps(string id);
        /// <summary>更新一个应用信息。</summary>
        /// <param name="obj">要更新的应用信息。</param>
        /// <returns>操作结果信息。</returns>
        [OperationContract]
        OperateResult UpdateApp(AppObject obj);
        /// <summary>根据应用编码查询应用实体</summary>
        /// <param name="code">要查询的应用编码。</param>
        /// <returns>返回应用信息。</returns>
        [OperationContract]
        AppObject SearchAppByCode(string code);
        #endregion

        #region 服务表
        /// <summary>获取所有服务表的数据。</summary>
        /// <returns>操作结果信息</returns>
        [OperationContract]
        List<ServiceObject> GetServices();
        /// <summary>插入数据服务信息对象实例。</summary>
        /// <param name="obj"></param>
        /// <returns>操作结果信息</returns>
        [OperationContract]
        OperateResult InsertService(ServiceObject obj);
        /// <summary>删除数据服务信息对象实例。</summary>
        /// <param name="id">要删除服务信息的编号。</param>
        /// <returns>操作结果信息</returns>
        [OperationContract]
        OperateResult DeleteService(string id);
        /// <summary>更新数据服务信息对象实例。</summary>
        /// <param name="obj"></param>
        /// <returns>操作结果信息</returns>
        [OperationContract]
        OperateResult UpdateService(ServiceObject obj);
        /// <summary>根据数据服务编码查询应用实体</summary>
        /// <param name="code">要查询的数据服务编码。</param>
        /// <returns>返回应用信息。</returns>
        [OperationContract]
        ServiceObject SearchServiceByCode(string code);
        #endregion

        /// <summary>插入用户组角色关联信息</summary>
        /// <param name="roleID"></param>
        /// <param name="userIDs"></param>
        /// <returns></returns>
        [OperationContract]
        OperateResult AssignUserRole(string roleID,string[] userIDs);
        /// <summary>插入角色应用关联信息</summary>
        /// <param name="roleID"></param>
        /// <param name="appIDs"></param>
        /// <returns></returns>
        [OperationContract]
        OperateResult AssignRoleApp(string roleID, string[] appIDs);
        /// <summary>插入角色服务关联信息</summary>
        /// <param name="roleID"></param>
        /// <param name="serviceIDs"></param>
        /// <returns></returns>
        [OperationContract]
        OperateResult AssignRoleService(string roleID, string[] serviceIDs);
        /// <summary>根据角色编号查询该角色包含的用户编号列表。</summary>
        /// <param name="rid"></param>
        /// <returns></returns>
        [OperationContract]
        List<string> GetUserAuthoritys(string rid);
        /// <summary>根据角色编号查询该角色包含的应用编号列表。</summary>
        /// <returns></returns>
        [OperationContract]
        List<string> GetAppAuthoritys(string rid);

        /// <summary>根据角色编号查询该角色包含的数据服务编号列表。</summary>
        /// <returns></returns>
        [OperationContract]
        List<string> GetServiceAuthoritys(string rid);
        [OperationContract]
        string GetParameter(string key);
        [OperationContract]
        OperateResult UpdateParameter(string key, string value);

        [OperationContract]
        OperateResult SetMapAutoload(string[] ids);
        [OperationContract]
        OperateResult SetMapUnAutoload(string[] ids);
    }
}